import { queryPageDataReq } from "./services";
import { namespace } from "./configFile";
import { message } from "antd";

export default {
  namespace,
  state: {
    data: {},
  },
  effects: {
    *pageInit({ params }, { call, put }) {
      let id = params.id;
      const res = yield call(queryPageDataReq, { ...params, id });
      console.log(res);
      yield put({
        type: "save",
        payload: {
          data: res,
        },
      });
    },
  },
  reducers: {
    save(state: any, { payload }: any) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
